package com.fuze.energy.netty;

import com.fuze.energy.netty.handler.NettyServerHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @author sepc_
 * @date 8/16/2021 14:58
 * Netty初始化
 */
public class NettyServerInitializer extends ChannelInitializer<SocketChannel> {

    public NettyServerInitializer() {
    }

    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();
        // 消息连接处理器，不使用解码器，解码之后的消息不会进入到征尔处理器中，需要单独定制
        pipeline.addLast(new NettyServerHandler());
    }
}
